#{extends 'main.html' /}
#{set title:'Home' /}

<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    FB.init({
      appId      : '209584849111018', // App ID
      status     : true, // check login status
      cookie     : true, // enable cookies to allow the server to access the session
      oauth      : true, // enable OAuth 2.0
      xfbml      : true  // parse XFBML
    });
  };
  
  // Load the SDK Asynchronously
  (function(d){
     var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
     js = d.createElement('script'); js.id = id; js.async = true;
     js.src = "//connect.facebook.net/pt_BR/all.js";
     d.getElementsByTagName('head')[0].appendChild(js);
   }(document));
  
  function fblogin() {
	  top.location.href='https://www.facebook.com/dialog/oauth?client_id=209584849111018&redirect_uri=http://localhost:8080/oauth&scope=user_birthday,user_education_history,user_hometown,user_interests,user_location,read_stream,publish_stream,email&response_type=code';
  } 
  
  function teste() {
	  FB.ui(
			  {
			    method: 'feed'
			  },
			  function(response) {
			    if (response && response.post_id) {
			      alert('Post was published.');
			    } else {
			      alert('Post was not published.');
			    }
			  }
			);
	}
  
</script>
<div>
<a href="#" onclick="teste();return false;">Teste</a>
</div>
<a href="#" onclick="fblogin();return false;"><img src="http://static.ak.fbcdn.net/rsrc.php/zB6N8/hash/4li2k73z.gif"></a>
</div>
<div>
<fb:facepile />
</div>

<!--<fb:login-button show-faces="yes" perms="user_birthday,user_education_history,user_hometown,user_interests,user_location,read_stream,publish_stream,email" onlogin="top.location.href='http://apps.facebook.com/votovivo'"></fb:login-button> -->
